#include "delay.h"
#include "dynamixel/port_handler.h"

static __IO uint32_t TimingDelay;


void Delay_Init(void)
{
	SysTick_Config(SystemCoreClock / 1000);
}

void TimingDelay_Decrement()
{
	if (TimingDelay != 0)
	{
		TimingDelay--;
	}
	dxl_current_ms++;
}

void Delay_ms(uint32_t nTime)
{
	TimingDelay = nTime;

	while(TimingDelay != 0);
}
